﻿using WS.EKA.Model;
using System.Collections.Generic;
using System;
using System.Linq;

namespace WS.EKA.DataAccess
{
    public class BaskOrderLogContext : DBContext<BaskOrderLog>
    {
        public static List<BaskOrderLogAndComments> GetBaskOrderLogAndComments(Guid id)
        {
            using (var context = BaskOrderLogContext.CreateContext() as DBContextBase)
            {
                var query = from p in context.BaskOrderLog
                            join c in context.BaskOrderComment
                            on p.Guid equals c.BaskOrderGuid
                            into g
                            where p.Guid == id
                            select new BaskOrderLogAndComments() { BaskOrderLog = p, BaskOrderComments = g };
                return query.ToList();
            }
        }

    }
}
